<template>
  <m-page>
    <!-- 身份信息认证页 -->
    <m-header title="身份认证申请"></m-header>
    <!-- 提示 -->
    <div class="g-tip">
      <p class="g-tip-wenxin">
        温馨提示：身份信息仅用于长沙银行快乐流水贷申请，我们将严格保护您的个人隐私！
      </p>
      <p>请拍摄一下证件照片，请注意避免证件反光。</p>
    </div>
    <!-- 照片 -->
    <div class="g-pic">
      <div class="g-pic-people">
        <div></div>
        <div>
          <span>身份证人像面</span>
        </div>
      </div>
      <div class="g-pic-country">
        <div></div>
        <div>
          <span>身份证国徽面</span>
        </div>
      </div>
    </div>
    <!-- 提示 -->
    <div class="g-tip">
      <p>请确认身份信息，若有误请点击修改</p>
    </div>
    <!-- 身份证信息 -->
    <div class="g-message">
      <ul>
        <li>
          <div>
            <span>户名</span>
          </div>
          <div>
            <span>梁先荣</span>
          </div>
        </li>
        <li>
          <div>
            <span>身份证号</span>
          </div>
          <div></div>
        </li>
        <li>
          <div>
            <span>身份证有效期</span>
          </div>
          <div></div>
        </li>
        <li>
          <div>
            <span>所在地区</span>
          </div>
          <div></div>
        </li>
        <li>
          <div>
            <span>详细地址</span>
          </div>
          <div></div>
        </li>
      </ul>
    </div>
    <!-- 按钮 -->
    <div class="g-button">
      <ynet-button type="warning">下一步</ynet-button>
    </div>
  </m-page>
</template>

<script>
import { Button } from "ynet-mobile";
import { limitApply, sendSMSCode } from "../request";
export default {
  components: {
    [Button.name]: Button
  },
  data() {
    return {
      // 身份证人面照
      faceImg: "",
      // 身份证国徽照
      nationalEmblemaddress: "",
      // 姓名
      name: "",
      // 身份证号
      idNumber: "",
      // 所在地区
      address: "",
      // 详细地址
      addressDetails: ""
    };
  },
  created() {},
  methods: {
    // 获取验证码
    getCode() {
      let params = {};
      sendSMSCode(params)
        .then(res => {
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
    handClick() {
      // 判断是否非空
      if (this.faceImg === "") {
        app.api.showToast("请选择身份证人面照");
        return;
      } else if (this.nationalEmblemaddress === "") {
        app.api.showToast("请选择身份证国徽照");
        return;
      } else if (this.name === "") {
        app.api.showToast("请输入姓名");
        return;
      } else if (this.idNumber === "") {
        app.api.showToast("请输入身份证号");
        return;
      } else if (this.address === "") {
        app.api.showToast("请选择所在地区");
        return;
      } else if (this.addressDetails === "") {
        app.api.showToast("请输入详细地址");
        return;
      }
      // 跳转参数
      let params = {};
      // 额度申请提交接口调用
      limitApply(params)
        .then(res => {
          console.log(res);
          // 把身份信息认证页的数据保存
          let params = {
            faceImg: this.faceImg,
            nationalEmblemaddress: this.nationalEmblemaddress,
            name: this.name,
            idNumber: this.idNumber,
            address: this.address,
            addressDetails: this.addressDetails
          };
          //跳转到身份信息认证页
          app.api.pushWindow(
            "water_borrowed/quota_add_settlement_card.html",
            params
          );
        })
        .catch(err => {
          console.log(err);
        });
    }
  },
  mounted() {},
  watch: {},
  computed: {}
};
</script>

<style lang="scss" scoped>
@import "./index.scss";
</style>
